import request from "@/utils/request";

export default {
  add(data) {
    return request({
      url: `/grade/add`,
      method: "post",
      data,
    });
  },
  update(data) {
    return request({
      url: `/grade/update`,
      method: "post",
      data,
    });
  },
  all() {
    return request({
      url: `/grade/all`,
      method: "get",
    });
  },
  list(name, currentPage, pageSize) {
    name = name ? name : "_";
    return request({
      url: `/grade/list/${name}/${currentPage}/${pageSize}`,
      method: "get",
    });
  },
  total(name) {
    name = name ? name : "_";
    return request({
      url: `/grade/total/${name}`,
      method: "get",
    });
  },
  delete(id) {
    return request({
      url: `/grade/delete/${id}`,
      method: "delete",
    });
  },
  getUserRank() {
    return request({
      url: `/grade/getUserRank`,
      method: "get",
    });
  },
  /**
   * 根据subjectId和gradeId统计分数
   */
  getStatictics(subjectId, gradeId) {
    return request({
      url: `/grade/getStatictics/${subjectId}/${gradeId}`,
      method: "get",
    });
  },
  /**
   * 查找某学员的某科成绩分数变化情况
   * @param {user表id} userId
   * @param {subject表id} subjectId
   * @param {grade表id} gradeId
   */
  showDetail(userId, subjectId, gradeId) {
    return request({
      url: `/grade/showDetail/${subjectId}/${gradeId}/${userId}`,
      method: "get",
    });
  },
  /**
   * 获取所有基础执照班级
   */
  allR3() {
    return request({
      url: `/grade/allR3`,
      method: "get",
    });
  },
};
